package com._复习;

import java.util.Scanner;

public class Test06 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = new int[6];
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入第" + (i + 1) + "个评委评分");
            arr[i] = sc.nextInt();
        }
        int ping = (he(arr) - min(arr) - max(arr)) / (arr.length - 2);
        System.out.println(ping);
    }
    //最大值
    public static int max(int[] arr) {
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }

        return max;
    }
//    最小值
    public static int min(int[] arr) {
        int min = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        return min;
    }
    //和
    public static int he(int[] arr) {
        int he = 0;
        for (int i = 0; i < arr.length; i++) {
            he += arr[i];
        }
        return he;
    }
}
